package com.qianxiwitmanagement.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qianxi.wit.pojo.TbAdvertising;
import com.qianxi.wit.result.R;
import com.qianxiwitmanagement.service.TbAdvertisingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zqp
 * @since 2021-01-15
 */
@RestController
@RequestMapping("/advertising")
public class TbAdvertisingController {
    @Autowired
    private TbAdvertisingService advertisingService;

    @GetMapping("/register/{page}/{size}")
    public R register(@PathVariable("page") int page,
                      @PathVariable("size") int size){
        try {
            Page<TbAdvertising> page1 = advertisingService.register(page,size);
            return R.ok().data("total",page1.getTotal()).data("list",page1.getRecords());
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}

